<?php
namespace Admin\Controller;
use Think\Controller;
use Think\Page;
use Common\Controller\BaseController;
class StatusController extends BaseController{
    public function View(){
        $staffinfo=D('Staff');
        $count=$staffinfo->count();
        $page=new Page($count, 15);
        $page->setConfig('first', '首页');
        $page->setConfig('prev', '上一页');
        $page->setConfig('next', '下一页');
        $page->setConfig('last', '末页');
        $page->rollPage='10';
        $page->setConfig('theme', '%HEADER%  共    %TOTAL_PAGE% 页   %FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END%');
        $show=$page->show();        
        $stafflist=$staffinfo       
        ->limit($page->firstRow.','.$page->listRows)
        ->order('status desc')
        ->select(); 
        $search='%'.$_POST['searchstaff'].'%';
        $where['name']=array('like',$search);
        $result=$staffinfo       
        ->limit($page->firstRow.','.$page->listRows)
        ->order('status desc')
        ->where($where)
        ->select(); 
        if($result){
            $this->assign('statuslist', $result);
        }else {
            $this->assign('statuslist', $stafflist);
        }     
        $this->assign('page',$show);
        $this->assign('title','所有员工状态页面');
        $this->display('Status_list');
        
    }
    
}